<?php
/* @var $this StrukturController */
/* @var $dataProvider CActiveDataProvider */
//cs()->registerScriptFile(bu() . '/plugins/jquery-ui-1.9.1.custom.min.js');
cs()->registerCoreScript('jquery.ui');
cs()->registerScriptFile(bu() . '/plugins/primitives.min.js');
cs()->registerCssFile(bu() . '/css/primitives.latest.css');
cs()->registerScript('org', $script, CClientScript::POS_HEAD);
?>
<!--<div class="judul2" style="padding:3px 15px">STRUKTUR ORGANISASI</div>
<div class="basicdiagram" style="width:640px; height:480px; border-style:dotted; border-width:1px;" />-->

<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog',
	array(
    'id' => 'mydialog',
    // additional javascript options for the dialog plugin
    'options' => array(
	'title' => 'Struktur Organisasi Sultan Fatah 81',
	'autoOpen' => true,
	'modal' => true,
	'width' => 1100,
	'resizable' => false,
	'height' => 1000, //'auto',
    ),
));

echo '<div style="position:relative;height:90%;border-style:dotted; border-width:0px;">
        <div class="basicdiagram" style="width:100%; height:100%;" />
       </div>';
echo '<div style="position:relative;" class="fontcolor1668b1 fontfamcalibry font24">Data Koordinator Sultan Fatah 81 Tingkat Kabupaten - Desa</div>';
echo '<div style="position:relative;width:1020px" class="fontcolorbiru0b5fa5 font12 fontfamcalibry" >';
echo '<div style="position:relative;padding-left:8px" class="fontcolor1668b1 fontfamcalibry font18">Area Kabupaten</div>';
$kabupaten = '';
$i = 0;

foreach ($respengkab as $respengkab):


    if ($kabupaten == $respengkab['nama_kabupaten']) {

	$kabupaten = $kabupaten;

	if ($respengkab['jabatan'] <> null) {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKabupaten($respengkab['jabatan']) . '
                  </td>
                  <td style="padding-left:5px">
                   ' . $respengkab['nama'] . '
                  </td>
                  </tr>
                   ';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                  -
                  </td>
                  <td style="padding-left:5px">
                  -
                  </td>
                  </tr>
                   ';
	}
    } else {
	if ($kabupaten <> '' || $kabupaten == $respengkab['nama_kabupaten']) {
	    echo '</table> <br/></div>';
	}

	$i++;

	$kabupaten = $respengkab['nama_kabupaten'];

	if ($i % 3 == 1) {
	    echo '<div style="clear:both"></div>';
	}

	echo '<div style="margin:5px 10px;float:left"><table border="1" cellpadding="0" cellspacing="0" style="width:300px;line-height:18pt;">
                  <tr>
                  <td colspan="2" style="padding-left:5px">
                   Kabupaten ' . $kabupaten . '
                  </td>
                  </tr>';

	if ($respengkab['jabatan'] <> null) {
	    echo'<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKabupaten($respengkab['jabatan']) . '
                  </td>
                 <td style="padding-left:5px">
                   ' . $respengkab['nama'] . '
                  </td>
                  </tr>';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                       -
                  </td>
                  <td style="padding-left:5px">
                      -
                  </td>
                  </tr>
                   ';
	}
    }




endforeach;
echo '</table> <br/></div>';

echo '</div>';





// area kecamatan

echo '<div style="clear:both"><hr/></div><div style="position:relative;width:1020px" class="fontcolorbiru0b5fa5 font12 fontfamcalibry" >';
echo '<div style="position:relative;padding-left:8px" class="fontcolor1668b1 fontfamcalibry font18">Area Kecamatan</div>';
$kecamatan = '';
$i = 0;

foreach ($respengkec as $respengkec):


    if ($kecamatan == $respengkec['nama_kecamatan']) {

	$kecamatan = $kecamatan;

	if ($respengkec['jabatan'] <> null) {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKecamatan($respengkec['jabatan']) . '
                  </td>
                  <td style="padding-left:5px">
                   ' . $respengkec['nama'] . '
                  </td>
                  </tr>
                   ';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                  -
                  </td>
                  <td style="padding-left:5px">
                  -
                  </td>
                  </tr>
                   ';
	}
    } else {
	if ($kecamatan <> '' || $kecamatan == $respengkec['nama_kecamatan']) {
	    echo '</table> <br/></div>';
	}

	$i++;

	$kecamatan = $respengkec['nama_kecamatan'];

	if ($i % 3 == 1) {
	    echo '<div style="clear:both"></div>';
	}

	echo '<div style="margin:5px 10px;float:left"><table border="1" cellpadding="0" cellspacing="0" style="width:300px;line-height:18pt;">
                  <tr>
                  <td colspan="2" style="padding-left:5px">
                   Kecamatan ' . $kecamatan . '
                  </td>
                  </tr>';

	if ($respengkec['jabatan'] <> null) {
	    echo'<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKecamatan($respengkec['jabatan']) . '
                  </td>
                 <td style="padding-left:5px">
                   ' . $respengkec['nama'] . '
                  </td>
                  </tr>';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                       -
                  </td>
                  <td style="padding-left:5px">
                      -
                  </td>
                  </tr>
                   ';
	}
    }




endforeach;
echo '</table> <br/></div>';

echo '</div>';








// area kelurahan

echo '<div style="clear:both"><hr/></div><div style="position:relative;width:1020px" class="fontcolorbiru0b5fa5 font12 fontfamcalibry" >';
echo '<div style="position:relative;padding-left:8px" class="fontcolor1668b1 fontfamcalibry font18">Area Kelurahan</div>';
$kelurahan = '';
$i = 0;

foreach ($respengkel as $respengkel):


    if ($kelurahan == $respengkel['nama_kelurahan']) {

	$kelurahan = $kelurahan;

	if ($respengkel['jabatan'] <> null) {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKelurahan($respengkel['jabatan']) . '
                  </td>
                  <td style="padding-left:5px">
                   ' . $respengkel['nama'] . '
                  </td>
                  </tr>
                   ';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                  -
                  </td>
                  <td style="padding-left:5px">
                  -
                  </td>
                  </tr>
                   ';
	}
    } else {
	if ($kelurahan <> '' || $kelurahan == $respengkel['nama_kelurahan']) {
	    echo '</table> <br/></div>';
	}

	$i++;

	$kelurahan = $respengkel['nama_kelurahan'];

	if ($i % 3 == 1) {
	    echo '<div style="clear:both"></div>';
	}

	echo '<div style="margin:5px 10px;float:left"><table border="1" cellpadding="0" cellspacing="0" style="width:300px;line-height:18pt;">
                  <tr>
                  <td colspan="2" style="padding-left:5px">
                   Kecamatan ' . $kelurahan . '
                  </td>
                  </tr>';

	if ($respengkel['jabatan'] <> null) {
	    echo'<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusKelurahan($respengkel['jabatan']) . '
                  </td>
                 <td style="padding-left:5px">
                   ' . $respengkel['nama'] . '
                  </td>
                  </tr>';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                       -
                  </td>
                  <td style="padding-left:5px">
                      -
                  </td>
                  </tr>
                   ';
	}
    }




endforeach;
echo '</table> <br/></div>';

echo '</div>';








// area desa

echo '<div style="clear:both" ><hr/></div> <div style="position:relative;width:1020px" class="fontcolorbiru0b5fa5 font12 fontfamcalibry" >';
echo '<div style="position:relative;padding-left:8px" class="fontcolor1668b1 fontfamcalibry font18">Area Desa</div>';
$desa = '';
$i = 0;

foreach ($respengdes as $respengdes):


    if ($desa == $respengdes['nama_desa']) {

	$desa = $desa;

	if ($respengdes['jabatan'] <> null) {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusDesa($respengdes['jabatan']) . '
                  </td>
                  <td style="padding-left:5px">
                   ' . $respengdes['nama'] . '
                  </td>
                  </tr>
                   ';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                  -
                  </td>
                  <td style="padding-left:5px">
                  -
                  </td>
                  </tr>
                   ';
	}
    } else {
	if ($desa <> '' || $desa == $respengdes['nama_desa']) {
	    echo '</table> <br/></div>';
	}

	$i++;

	$desa = $respengdes['nama_desa'];

	if ($i % 3 == 1) {
	    echo '<div style="clear:both"></div>';
	}

	echo '<div style="margin:5px 10px;float:left"><table border="1" cellpadding="0" cellspacing="0" style="width:300px;line-height:18pt;">
                  <tr>
                  <td colspan="2" style="padding-left:5px">
                   Kecamatan ' . $desa . '
                  </td>
                  </tr>';

	if ($respengdes['jabatan'] <> null) {
	    echo'<tr>
                  <td style="width:100px;padding-left:5px">
                   ' . u::getPengurusDesa($respengdes['jabatan']) . '
                  </td>
                 <td style="padding-left:5px">
                   ' . $respengdes['nama'] . '
                  </td>
                  </tr>';
	} else {
	    echo '<tr>
                  <td style="width:100px;padding-left:5px">
                       -
                  </td>
                  <td style="padding-left:5px">
                      -
                  </td>
                  </tr>
                   ';
	}
    }




endforeach;
echo '</table> <br/></div>';

echo '</div>';



$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
